﻿using RockBus.ConfigurationService.Interfaces;
using RockBus.DataContracts;
using System.Web.Http;

namespace RockBus.Services.WebApi
{
    public class ConfigurationServiceController : ApiController, IConfigurationService
    {
        public ConfigurationServiceController(IConfigurationService configurationService)
        {
            this.ConfigurationService = configurationService;
        }

        private IConfigurationService ConfigurationService { get; set; }

        [HttpGet]
        [ActionName("GetSubscriberConfiguration")]
        public SubscriberConfiguration GetSubscriberConfiguration()
        {
            return this.ConfigurationService.GetSubscriberConfiguration();
        }

        [HttpPost]
        [ActionName("AddOrUpdateSubscribers")]
        public RockBusAck AddOrUpdateSubscribers(AddOrUpdateSubscribersRequest request)
        {
            return this.ConfigurationService.AddOrUpdateSubscribers(request);
        }

        [HttpPost]
        [ActionName("RemoveSubscribers")]
        public RockBusAck RemoveSubscribers(RemoveSubscribersRequest request)
        {
            return this.ConfigurationService.RemoveSubscribers(request);
        }

        [HttpPost]
        [ActionName("RemoveSubscriptions")]
        public RockBusAck RemoveSubscriptions(RemoveSubscriptionsRequest request)
        {
            return this.ConfigurationService.RemoveSubscriptions(request);
        }

        [HttpGet]
        [ActionName("GetPublisherConfiguration")]
        public PublisherConfiguration GetPublisherConfiguration()
        {
            return this.ConfigurationService.GetPublisherConfiguration();
        }

        [HttpPost]
        [ActionName("AddOrUpdatePublishers")]
        public AddOrUpdatePublishersResponse AddOrUpdatePublishers(AddOrUpdatePublishersRequest request)
        {
            return this.ConfigurationService.AddOrUpdatePublishers(request);
        }

        [HttpPost]
        [ActionName("RemovePublishers")]
        public RockBusAck RemovePublishers(RemovePublishersRequest request)
        {
            return this.ConfigurationService.RemovePublishers(request);
        }

        [HttpPost]
        [ActionName("RemoveReceivePorts")]
        public RockBusAck RemoveReceivePorts(RemoveReceivePortsRequest request)
        {
            return this.ConfigurationService.RemoveReceivePorts(request);
        }

        [HttpPost]
        [ActionName("RemoveAllSubscribers")]
        public RockBusAck RemoveAllSubscribers(RemoveAllSubscribersRequest request)
        {
            return this.ConfigurationService.RemoveAllSubscribers(request);
        }

        [HttpPost]
        [ActionName("RemoveAllPublishers")]
        public RockBusAck RemoveAllPublishers(RemoveAllPublishersRequest request)
        {
            return this.ConfigurationService.RemoveAllPublishers(request);
        }

        [HttpPost]
        [ActionName("GetInternalConfiguration")]
        public GetInternalConfigurationResponse GetInternalConfiguration(GetInternalConfigurationRequest request)
        {
            return this.ConfigurationService.GetInternalConfiguration(request);
        }

        [HttpPost]
        [ActionName("SetInternalConfiguration")]
        public RockBusAck SetInternalConfiguration(SetInternalConfigurationRequest request)
        {
            return this.ConfigurationService.SetInternalConfiguration(request);
        }
    }
}
